package com.firefly.service.repository.cms;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.firefly.dao.dao.cms.po.LinkTypePo;
import com.firefly.dao.dao.cms.service.LinkTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @description: 链接分类
 * @author: lzg(萤火科技 ： 854378082 @ qq.com)
 * @date: 2022/12/20
 **/
@Repository
public class LinkTypeRepository {
    private final LinkTypeService linkTypeService;
    @Autowired
    public LinkTypeRepository(LinkTypeService linkTypeService){
        this.linkTypeService = linkTypeService;
    }

    public Boolean create(LinkTypePo entity){
        return linkTypeService.save(entity);
    }
    public Boolean update(LinkTypePo entity){
        return linkTypeService.updateById(entity);
    }
    public Boolean updateDelFlagByIds(List<Integer> ids){
        UpdateWrapper<LinkTypePo> updateWrapper = new UpdateWrapper<>();
        updateWrapper.in("id",ids).set("del_flag",1);
        return linkTypeService.update(updateWrapper);
    }
}
